<%@ page language="java" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,
                 com.scalar.chiptrack.users.Functionality,
                 com.scalar.chiptrack.users.User"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>


<chiptrack:checkLogon sourcePage="/shippingRequest.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();try{
%>
<HTML>
<HEAD><TITLE>Scalarsoft - ChipTrac </TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet"></HEAD>

<SCRIPT language="JavaScript">
<%--function sendMail ( assmReleaseId )
{
    newWindow = window.open ('<%=chipTracContext%>/sendAssmMail.do?type=Sort&assmReleaseId=' + assmReleaseId,'sendMailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=800,height=550,resizable=yes');
    newWindow.focus();
}--%>
function confirmShipRequest()
{
    var shipRequestId = document.shippingRequestViewForm['shippingRequest.shipRequestId'].value;
    document.shippingRequestViewForm.action='<%=chipTracContext%>/shippingRequest.do?action=approved&isConfirm=true&shipReqId='+shipRequestId;
    document.shippingRequestViewForm.submit();
}
function cancelShipRequest()
{
    var shipRequestId = document.shippingRequestViewForm['shippingRequest.shipRequestId'].value;
    document.shippingRequestViewForm.action='<%=chipTracContext%>/shippingRequest.do?action=cancel&isCancel=true&shipReqId='+shipRequestId;
    document.shippingRequestViewForm.submit();
}
function closeShipRequest()
{
    var shipRequestId = document.shippingRequestViewForm['shippingRequest.shipRequestId'].value;
    document.shippingRequestViewForm.action='<%=chipTracContext%>/shippingRequest.do?action=close&isClose=true&shipReqId='+shipRequestId;
    document.shippingRequestViewForm.submit();
}

</SCRIPT>
<BODY bgColor='#ffffff' leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
    <html:form action="/shippingRequest.do" name="shippingRequestViewForm" method="POST" type="com.scalar.chiptrack.operations.shippingRequest.forms.ShippingRequestForm">
        <nested:nest property="shippingRequest" >
        <TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='90%' bordercolor='#000000' ALIGN='CENTER'>
            <logic:equal  name="isConfirm" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Confirm this Ship Request &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:confirmShipRequest();' onmouseover="window.status='Confirm this Ship Request';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/shippingRequest.do" onMouseOver="window.status='Go Back to Main Ship Request Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
            </logic:equal>
            <logic:equal  name="isCancel" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Cancel this Ship Request &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:cancelShipRequest();' onmouseover="window.status='Cancel this Ship Request';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/shippingRequest.do" onMouseOver="window.status='Go Back to Main Ship Request Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
            </logic:equal>
            <logic:equal  name="isClose" value="true">
                <logic:equal name="showMessage" value="TRUE">
                    <tr><td colspan="4" align='left'><font class='NArialS'color='blue'><b><%=Constants.NO_APPROVE_RIGHTS %></b></font></td></tr>
                </logic:equal>
                <tr>
                    <td colspan='4'>
                    <font class='NArialL'><font color='red'>Are you sure, you want to Close this Ship Request &nbsp;&nbsp;</font></font>
                    <chiptrack:restrictedLink functionality='<%=Functionality.APPROVE_SORT_RELEASE %>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:closeShipRequest();' onmouseover="window.status='Close this Ship Request';return true" onmouseout="window.status='';return true"><img src='<%=chipTracContext%>/jsp/includes/images/confirm.gif' border='0'></chiptrack:restrictedLink>
                    &nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="<%=chipTracContext%>/shippingRequest.do" onMouseOver="window.status='Go Back to Main Ship Request Menu';return true" onMouseOut="window.status='';return true">
                    <img src='<%=chipTracContext%>/jsp/includes/images/back.gif' border='0'></a>
                    </td>
                </tr>
            </logic:equal>

            <TR>
                <TD width="90%" valign="center" >&nbsp;</TD>
                <TD width="5%" valign="center" >
                    <a href="javascript:window.print();" title='Click to Print Ship Request Instructions'><img height="80" width="60" src="<%=chipTracContext%>/jsp/includes/images/printer_icon_small.gif" border="0"></a>
                </TD>
            </TR>
        </TABLE>
    <nested:hidden property="shipRequestId"/>
    <table width="90%" cellspacing='0' cellpadding='0' border=0 align=center bgcolor='#FFFFEE' bordercolor='black'>
    <tr><td colspan=4  align="center" bgcolor='#DEE1E2' CLASS='NArialW'>Ship Request</td></tR>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
        <td class="NArialL">From Location :</td>
        <td class="NArialL"><nested:write property="fromVendorName"/><BR></td>
        <td class="NArialL">Date :</td>
        <td class="NArialL"><nested:write  property="shipReqDate"/>&nbsp;</td>
    </tr>
    <tr>
        <td class="NArialL">&nbsp;</td>
        <td class="NArialL">
            <nested:write property="fromVendorAddress.contactPerson"/><BR>
            <nested:write  property="fromLocationAddressAsHTML" filter="false"/><BR>
        </td>
        <td class="NArialL">Ship Request Number :</td>
        <td class="NArialL"><nested:write  property="shipReqNumber"/>&nbsp;</td>
    </tr>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
        <td class="NArialL">To Location :</td>
        <td class="NArialL"><nested:write  property="toVendorName"/><BR></td>
        <td class="NArialL">&nbsp;</td>
        <td class="NArialL">&nbsp;</td>
    </tr>
    <tr>
        <td class="NArialL">&nbsp;</td>
        <td class="NArialL" colspan="3">
            <nested:write property="toVendorAddress.contactPerson"/><BR>
            <nested:write  property="toLocationAddressAsHTML" filter="false"/><BR>
        </td>
    </tr>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
        <td class="NArialL">Shipper :</td>
        <td class="NArialL" colsoan="3"><nested:write  property="shipperName" /><BR></td>
    </tr>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
        <td class="NArialL">Please send ship alerts to :</td>
        <td class="NArialL" colsoan="3" ><nested:write  property="shipAlertAsHTML" filter="false"/><BR></td>
    </tr>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr><td colspan=4 class="NArialL">Please ship the following product</td></tR>
    <tr>
        <td class="NArialL">Product :</td>
        <td class="NArialL"><nested:write  property="partNumber" /><BR></td>
        <td class="NArialL">Total Qty</td>
        <td class="NArialL"><nested:write  property="totalQty" /></td>
    </tr>
    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
        <TD colspan="4" width="100%">
        <TABLE bgcolor='#FFFFEE'>
            <TR>
                <td class="NArialL" align="center">Lot Number</td>
                <TD class="NArialL">&nbsp;</td>
                <td class="NArialL" align="center">Qty</td>
            </TR>
            <nested:iterate property="lotList" type="com.scalar.chiptrack.operations.shippingRequest.ShippingRequestLot" id="shippingRequestLot" indexId="iteratorIdx" >
                <tr>
                    <td class="NArialL" align="left"><nested:write property="lotNumber" /></td>
                    <TD class="NArialL">&nbsp;</td>
                    <td class="NArialL" align="right"><nested:write property="pulledQty" /></td>
                </tr>
            </nested:iterate>
        </TABLE>
        </TD>
    </tr>

    <tr><td colspan=4><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tR>
    <tr>
         <td class="NArialL">Special Instructions :</td>
         <td class="NArialL" colspan="3"><nested:write property="specialInstr" /><BR></td>
    </tr>
</table>
</nested:nest>
</html:form>
</body>
</html>
<%}catch(Exception e){e.printStackTrace();}%>
